//
//  YYJLEvalutionReportController.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/9.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLEvalutionReportController.h"
#import "YYJLAnalysisController.h"
@interface YYJLEvalutionReportController ()
{
    UIScrollView * _scrollview;
    UILabel      * title;//考试名称
    UILabel      * scoreLb;//分数
    UILabel      * situationLb;//答题情况
    
}
@end

@implementation YYJLEvalutionReportController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setTitleView:@"测评报告"];
    [self setBackItem];
    [self creatUI];
    
}

-(void)creatUI{
    UIView * titleView=[[UIView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 44*PER_HEIGHT)];
    titleView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:titleView];
    
    title =[MyControl createLabelWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 44*PER_HEIGHT) Font:15 Text:@"2015年11月考试试题" Color:BLACK_COLOR];
    title.textAlignment=NSTextAlignmentCenter;
    [self.view addSubview:title];
    
    _scrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(0, title.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-64-title.height-56*PER_HEIGHT)];
    _scrollview.backgroundColor=[UIColor clearColor];
    [self.view addSubview:_scrollview];
    
    //分数区
    UIView * scoreView=[[UIView alloc]initWithFrame:CGRectMake(12*PER_WIDTH, 10*PER_HEIGHT, 351*PER_WIDTH, 200*PER_HEIGHT)];
    scoreView.backgroundColor=[UIColor whiteColor];
    scoreView.layer.cornerRadius=10;
    [_scrollview addSubview:scoreView];
    
    UILabel * lab1=[MyControl createLabelWithFrame:CGRectMake(10*PER_WIDTH, 15*PER_HEIGHT, 100, 15*PER_HEIGHT) Font:15 Text:@"答题分数:" Color:BLACK_COLOR];
    [scoreView addSubview:lab1];
    
    UIView * roundView=[[UIView alloc]initWithFrame:CGRectMake(scoreView.width/2-50*PER_WIDTH, scoreView.height/2-50*PER_HEIGHT, 100*PER_WIDTH, 100*PER_WIDTH)];
    roundView.layer.cornerRadius=roundView.height/2;
    roundView.layer.borderColor=TINK_COLOR.CGColor;
    roundView.layer.borderWidth=1;
    [scoreView addSubview:roundView];
    
    scoreLb=[MyControl createLabelWithFrame:CGRectMake(30*PER_WIDTH, 36*PER_HEIGHT, 90*PER_WIDTH, 40*PER_HEIGHT) Font:40 Text:@"90" Color:TINK_COLOR];
    CGFloat width =[scoreLb.text boundingRectWithSize:CGSizeMake(1000, 40*PER_HEIGHT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:scoreLb.font} context:nil].size .width;
    scoreLb.width=width;
    [roundView addSubview:scoreLb];
    
    UILabel * fen =[MyControl createLabelWithFrame:CGRectMake(scoreLb.right+4*PER_WIDTH, roundView.height/2+5, 30, 12*PER_HEIGHT) Font:12 Text:@"分" Color:TINK_COLOR];
    [roundView addSubview:fen];
    
    situationLb=[MyControl createLabelWithFrame:CGRectMake(scoreView.width-10*PER_WIDTH-120*PER_WIDTH, scoreView.height-50*PER_HEIGHT, 120*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"9道/10道" Color:BLACK_COLOR];
    situationLb.textAlignment=NSTextAlignmentRight;
    [scoreView addSubview:situationLb];
    //统计区
    UIView * totalView=[[UIView alloc]initWithFrame:CGRectMake(12*PER_WIDTH,scoreView.bottom+ 10*PER_HEIGHT, 351*PER_WIDTH, 45*PER_HEIGHT+10/5*63*PER_HEIGHT )];
    totalView.backgroundColor=[UIColor whiteColor];
    totalView.layer.cornerRadius=10;
    [_scrollview addSubview:totalView];
    
    UIImageView * round1=[[UIImageView alloc]initWithFrame:CGRectMake(4*PER_WIDTH, totalView.top+27*PER_HEIGHT, 367*PER_WIDTH, 16*PER_WIDTH)];
    round1.image=[UIImage imageNamed:@"bg_fenge"];//367*16
        [_scrollview addSubview:round1];
    
    UILabel * lab2=[MyControl createLabelWithFrame:CGRectMake(10*PER_WIDTH, 15*PER_HEIGHT, 100, 15*PER_HEIGHT) Font:15 Text:@"答题情况:" Color:BLACK_COLOR];
    [totalView addSubview:lab2];
    
     UIImage * IMG =[UIImage imageNamed:@"ico_timu_sel"];//36*43
    for (int i=0; i<10; i++) {
        int j= i/5;
        int x= i%5;
        
        UIImageView * img=[[UIImageView alloc]initWithFrame:CGRectMake(17.5*PER_WIDTH+x*70*PER_WIDTH,lab2.bottom+ 25*PER_HEIGHT+j*63*PER_HEIGHT, 36*PER_WIDTH, 43*PER_HEIGHT)];
        img.tag=100+i;
        img.image=IMG;
        [totalView addSubview:img];
        
        UILabel * lab=[MyControl createLabelWithFrame:CGRectMake(0, 15*PER_HEIGHT, img.width, 20*PER_HEIGHT) Font:20 Text:[NSString stringWithFormat:@"%d",i+1] Color:UIColorFromHex(0xdea556)];
        lab.font=[UIFont fontWithName:HLT size:20];
        lab.font=[UIFont systemFontOfSize:20*PER_HEIGHT];
        lab.textAlignment=NSTextAlignmentCenter;
        [img addSubview:lab];

     }
    
    _scrollview.contentSize=CGSizeMake(0, scoreView.height+totalView.height+20*PER_HEIGHT);
    
    //按钮
    
    //取消按钮
    UIButton * cancelBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    cancelBtn.frame=CGRectMake(32*PER_WIDTH, SCREEN_HEIGHT-51*PER_HEIGHT, 120*PER_WIDTH, 30*PER_WIDTH);
    cancelBtn.layer.cornerRadius=cancelBtn.height/2;
    cancelBtn.layer.borderColor=TINK_COLOR.CGColor;
    cancelBtn.layer.borderWidth=1;
    cancelBtn.titleLabel.font=[UIFont fontWithName:HSGBW3 size:16];
    cancelBtn.titleLabel.font=[UIFont systemFontOfSize:16*PER_HEIGHT];
    [cancelBtn setTitle:@"全部解析" forState:0];
    [cancelBtn setTitleColor:UIColorFromHex(0xa21b18) forState:0];
    [cancelBtn addTarget:self action:@selector(cancelBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:cancelBtn];
    
    // 确定按钮
    UIButton * sureBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    sureBtn.frame=CGRectMake(cancelBtn.right+71*PER_WIDTH, SCREEN_HEIGHT-51*PER_HEIGHT, 120*PER_WIDTH, 30*PER_WIDTH);
    sureBtn.layer.cornerRadius=cancelBtn.height/2;
    //    sureBtn.layer.borderColor=TINK_COLOR.CGColor;
    //    sureBtn.layer.borderWidth=1;
    sureBtn.backgroundColor=TINK_COLOR;
    sureBtn.titleLabel.font=[UIFont fontWithName:HSGBW3 size:16];
    sureBtn.titleLabel.font=[UIFont systemFontOfSize:16*PER_HEIGHT];
    [sureBtn setTitle:@"错题解析" forState:0];
    [sureBtn setTitleColor:WHITE_COLOR forState:0];
    [sureBtn addTarget:self action:@selector(sureBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sureBtn];

    
}

#pragma mark--解析
-(void)cancelBtn{
    YYJLAnalysisController * analysis =[[YYJLAnalysisController alloc]init];
    analysis.style=AnalysisAll;
    [self.navigationController pushViewController:analysis animated:YES];
}
-(void)sureBtn{
    YYJLAnalysisController * analysis =[[YYJLAnalysisController alloc]init];
     analysis.style=AnalysisError;
    [self.navigationController pushViewController:analysis animated:YES];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
